/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.itcast.activiti.service;

import cn.itcast.ic.common.bean.Response;
import com.itcast.activiti.entity.ApproveDefinition;
import com.itcast.activiti.utils.ActivitiPage;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.api.internal.Internal;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletOutputStream;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 流程定义和部署
 */
@Internal
public interface IDeployRepositoryService {

    // bpmn文件创建新的部署
    Response<Map<String, Object>> createDeploymentFile(MultipartFile file, String key, String tenantId);

    // JSON方式创建新的部署
    String createDeploymentJson(ApproveDefinition approveDefinition);

    // 获取bpnm文件
    void getBpmnFile(String deploymentId, String processDefinitionId, String processDefinitionKey, ServletOutputStream outputStream);

    // 获取部署信息分页数据
    ActivitiPage listDeploymentPage(ActivitiPage activitiPage);

    // 验证不是流程key是否存在
    ActivitiPage checkProcessDefinitionKey(String processDefinitionKey);

    // 获取部署流程定义分页数据
    ActivitiPage listProcessDefinitionPage(ActivitiPage activitiPage);

    // 使用提供的流程定义id返回与流程定义对应的BpmnModel
    BpmnModel getBpmnModelByProcessDefinitionId(String processDefinitionId);

    List<String> listProcessDefinitionId(Set<String> processDefinitionKeys);
}
